import storageUtil from '@/utils/StorageUtil'

// local storage Key常量
export const PageVersionKey = 'ps_TmptAuthUser-page-version-key'
export const ConditionShowListCkedKey = 'ps_TmptAuthUser-condition-column-show-cked-list-key'
export const ColumnShowListCkedKey = 'ps_TmptAuthUser-list-column-show-cked-list-key'
export const isDropMenuKey = 'ps_TmptAuthUser-list-column-show-isdropmenu-key'
export const ColumnShowListWidthKey = 'ps_TmptAuthUser-list-column-width-key'
export const IsExpandedRowCkedKey = 'ps_TmptAuthUser-list-isexpanded-row-key'


// 查询条件 type: input/date/date-range/num-range/select/tree/
export const conditionOptions = [
  { property: 'name', label: '姓名', width: 200, show: true, type: 'input', dataResource: 0, enumName:'Name', remoteUrl: '' },
  { property: 'positionShow', label: 'positionShow', width: 200, show: true, type: 'input', dataResource: 0, enumName:'PositionShow', remoteUrl: '' },
  { property: 'contactType', label: 'contactType', width: 200, show: true, type: 'input', dataResource: 0, enumName:'ContactType', remoteUrl: '' },
  { property: 'policceNumber', label: 'policceNumber', width: 200, show: true, type: 'input', dataResource: 0, enumName:'PolicceNumber', remoteUrl: '' },
  { property: 'headPic', label: 'headPic', width: 200, show: true, type: 'input', dataResource: 0, enumName:'HeadPic', remoteUrl: '' },
  { property: 'lawEqpNo', label: 'lawEqpNo', width: 200, show: true, type: 'input', dataResource: 0, enumName:'LawEqpNo', remoteUrl: '' },
  { property: 'loginname', label: '登录名', width: 200, show: true, type: 'input', dataResource: 0, enumName:'Loginname', remoteUrl: '' },
  { property: 'tmptAuthDeptPostId', label: '所属部门', width: 200, show: true, type: 'input', dataResource: 0, enumName:'TmptAuthDeptPostId', remoteUrl: '' },
  { property: 'tmptUserType', label: '用户类型', width: 200, show: true, type: 'select', dataResource: 1, enumName:'TmptUserType', remoteUrl: '/core/enum/getData4AddBy' },
  { property: 'ctcRegionId', label: 'ctcRegionId', width: 200, show: true, type: 'input', dataResource: 0, enumName:'CtcRegionId', remoteUrl: '' },
  { property: 'jobNumber', label: '工号', width: 200, show: true, type: 'input', dataResource: 0, enumName:'JobNumber', remoteUrl: '' },
  { property: 'createdate', label: '创建日期', width: 200, show: true, type: 'date-range', dataResource: 0, enumName:'Createdate', remoteUrl: '' }
]
// 所有列对象
export const theadOptions = [
      { property: 'id', label: 'ID', width: storageUtil.getColumnWidthFromStorage('id', 72, ColumnShowListWidthKey), show: true, edit: false, sort: 'custom', fixed: false} ,
      { property: 'name', label: '姓名', width: storageUtil.getColumnWidthFromStorage('name', 150, ColumnShowListWidthKey), show: true, edit: true, sort: false, fixed: false} ,
      { property: 'positionShow', label: 'positionShow', width: storageUtil.getColumnWidthFromStorage('positionShow', 150, ColumnShowListWidthKey), show: true, edit: true, sort: false, fixed: false} ,
      { property: 'contactType', label: 'contactType', width: storageUtil.getColumnWidthFromStorage('contactType', 150, ColumnShowListWidthKey), show: true, edit: true, sort: false, fixed: false} ,
      { property: 'policceNumber', label: 'policceNumber', width: storageUtil.getColumnWidthFromStorage('policceNumber', 150, ColumnShowListWidthKey), show: true, edit: true, sort: false, fixed: false} ,
      { property: 'headPic', label: 'headPic', width: storageUtil.getColumnWidthFromStorage('headPic', 150, ColumnShowListWidthKey), show: true, edit: true, sort: false, fixed: false} ,
      { property: 'lawEqpNo', label: 'lawEqpNo', width: storageUtil.getColumnWidthFromStorage('lawEqpNo', 150, ColumnShowListWidthKey), show: true, edit: true, sort: false, fixed: false} ,
      { property: 'loginname', label: '登录名', width: storageUtil.getColumnWidthFromStorage('loginname', 150, ColumnShowListWidthKey), show: true, edit: true, sort: false, fixed: false} ,
      { property: 'tmptAuthDeptPostId', label: '所属部门', width: storageUtil.getColumnWidthFromStorage('tmptAuthDeptPostId', 150, ColumnShowListWidthKey), show: true, edit: true, sort: false, fixed: false} ,
      // 枚举对象， json结构，如: {'id':1, 'name':'无效'}
      { property: 'tmptAuthPosition.name', label: '内部职务', width: storageUtil.getColumnWidthFromStorage('tmptAuthPosition.name', 150, ColumnShowListWidthKey), show: true, edit: true, sort: false, fixed: false, dataResource: 1, columnType: 'select', enumName:'TmptAuthPosition', remoteUrl: '/core/enum/getData4AddBy'} ,
      // 枚举对象， json结构，如: {'id':1, 'name':'无效'}
      { property: 'tmptUserType.name', label: '用户类型', width: storageUtil.getColumnWidthFromStorage('tmptUserType.name', 150, ColumnShowListWidthKey), show: true, edit: true, sort: false, fixed: false, dataResource: 1, columnType: 'select', enumName:'TmptUserType', remoteUrl: '/core/enum/getData4AddBy'} ,
      { property: 'ctcRegionId', label: 'ctcRegionId', width: storageUtil.getColumnWidthFromStorage('ctcRegionId', 150, ColumnShowListWidthKey), show: true, edit: true, sort: false, fixed: false} ,
      { property: 'tmptAuthDeptId', label: '所属机构', width: storageUtil.getColumnWidthFromStorage('tmptAuthDeptId', 150, ColumnShowListWidthKey), show: false, edit: false, sort: false, fixed: false} ,
      { property: 'idcardno', label: '身份证', width: storageUtil.getColumnWidthFromStorage('idcardno', 150, ColumnShowListWidthKey), show: true, edit: true, sort: false, fixed: false} ,
      { property: 'email', label: 'email', width: storageUtil.getColumnWidthFromStorage('email', 150, ColumnShowListWidthKey), show: false, edit: true, sort: false, fixed: false} ,
      { property: 'jobNumber', label: '工号', width: storageUtil.getColumnWidthFromStorage('jobNumber', 150, ColumnShowListWidthKey), show: true, edit: true, sort: false, fixed: false} ,
      { property: 'phone', label: '电话', width: storageUtil.getColumnWidthFromStorage('phone', 150, ColumnShowListWidthKey), show: false, edit: true, sort: false, fixed: false} ,
      { property: 'telephone', label: '手机', width: storageUtil.getColumnWidthFromStorage('telephone', 150, ColumnShowListWidthKey), show: false, edit: true, sort: false, fixed: false} ,
      // 枚举对象， json结构，如: {'id':1, 'name':'无效'}
      { property: 'sex.name', label: '性别', width: storageUtil.getColumnWidthFromStorage('sex.name', 150, ColumnShowListWidthKey), show: false, edit: true, sort: false, fixed: false, dataResource: 1, columnType: 'select', enumName:'Sex', remoteUrl: '/core/enum/getData4AddBy'} ,
      { property: 'logintimelast', label: '最后登录时间', width: storageUtil.getColumnWidthFromStorage('logintimelast', 150, ColumnShowListWidthKey), show: false, edit: false, sort: false, fixed: false} ,
      { property: 'logintimes', label: '登录次数', width: storageUtil.getColumnWidthFromStorage('logintimes', 150, ColumnShowListWidthKey), show: false, edit: false, sort: false, fixed: false} ,
      { property: 'clientId', label: 'clientId', width: storageUtil.getColumnWidthFromStorage('clientId', 150, ColumnShowListWidthKey), show: false, edit: true, sort: false, fixed: false} ,
      // 枚举对象， json结构，如: {'id':1, 'name':'无效'}
      { property: 'deleteflag.name', label: '删除标志', width: storageUtil.getColumnWidthFromStorage('deleteflag.name', 150, ColumnShowListWidthKey), show: false, edit: false, sort: false, fixed: false, dataResource: 1, columnType: 'select', enumName:'Deleteflag', remoteUrl: '/core/enum/getData4AddBy'} ,
      { property: 'createdate', label: '创建日期', width: storageUtil.getColumnWidthFromStorage('createdate', 150, ColumnShowListWidthKey), show: true, edit: false, sort: false, fixed: false} ,
      { property: 'createman', label: '创建人', width: storageUtil.getColumnWidthFromStorage('createman', 150, ColumnShowListWidthKey), show: false, edit: false, sort: false, fixed: false} ,
      { property: 'modifydate', label: '修改日期', width: storageUtil.getColumnWidthFromStorage('modifydate', 150, ColumnShowListWidthKey), show: false, edit: false, sort: false, fixed: false} ,
      { property: 'modifyman', label: '修改人', width: storageUtil.getColumnWidthFromStorage('modifyman', 150, ColumnShowListWidthKey), show: false, edit: false, sort: false, fixed: false} ,
]

export const pickerOptions = {
  shortcuts: [{
    text: '最近一周',
    onClick(picker) {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
      picker.$emit('pick', [start, end])
    }
  }, {
    text: '最近一个月',
    onClick(picker) {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
      picker.$emit('pick', [start, end])
    }
  }, {
    text: '最近三个月',
    onClick(picker) {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
      picker.$emit('pick', [start, end])
    }
  }]
}

export const pickerOptionsSingleDate = {
  disabledDate(time) {
    return time.getTime() > Date.now()
  },
  shortcuts: [{
    text: '今天',
    onClick(picker) {
      picker.$emit('pick', new Date())
    }
  }, {
    text: '昨天',
    onClick(picker) {
      const date = new Date()
      date.setTime(date.getTime() - 3600 * 1000 * 24)
      picker.$emit('pick', date)
    }
  }, {
    text: '一周前',
    onClick(picker) {
      const date = new Date()
      date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
      picker.$emit('pick', date)
    }
  }]
}
